<?php
/**
 * Created by PhpStorm.
 * User: win7
 * Date: 2017/5/16
 * Time: 15:17
 */

defined('BASEPATH') OR exit('No direct script access allowed');

class Weipay extends CI_Controller
{
    private $data;

    public function __construct()
    {
        parent::__construct();
    }

    public function success()
    {
        $id = $this->input->get('id')?$this->input->get('id'):0;
        if($id){
            $this->load->library('C_weixinpay');
            $sendData = array();
            $sendData['order_id'] = $id;
            $sendData['password'] = $this->lg_user['password'];
            $sendData['uid'] = $this->lg_user['id'];
            $sendData['enterpriseId'] = $this->lg_user['enterpriseId'];
            $sendData['channelId'] = $this->lg_user['channelId'];
            $sendData['userType'] = $this->lg_user['type'];
            //制造接口请求
            $url = $this->c_weixinpay->set_call_items($sendData);
            $param = $this->c_weixinpay->get_call_items();
            $rs = $this->restcurl->put($url, $param);
            $rs['CallInfo']['rsa']['paySign'] = $rs['CallInfo']['rsa']['sign'];
            unset($rs['CallInfo']['rsa']['sign']);
            $this->data['info'] = $rs['CallInfo']['rsa'];
        }
        $this->data['id'] = $id;
        $this->load->view('weipay/success', $this->data);
    }
}